<?php /*a:8:{s:59:"E:\source\EasyPeak\application\content\view\news\model.html";i:1574601777;s:77:"E:\source\EasyPeak\application\content\view\..\..\common\view\admin_base.html";i:1572404708;s:56:"E:\source\EasyPeak\application\common\view\formitem.html";i:1574601954;s:61:"E:\source\EasyPeak\application\common\view\items\textbox.html";i:1574494844;s:58:"E:\source\EasyPeak\application\common\view\items\date.html";i:1574560406;s:61:"E:\source\EasyPeak\application\common\view\items\ueditor.html";i:1574494554;s:59:"E:\source\EasyPeak\application\common\view\items\radio.html";i:1574496813;s:62:"E:\source\EasyPeak\application\common\view\items\textarea.html";i:1574602877;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>编辑后台</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href=" /test/static/fontawesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/test/static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/test/static/admin/admin.css" media="all">
    <script src="/test/static/js/jquery.min.js"></script>
</head>
<body>
<script src="/test/static/layui/layui.js"></script>
<script>
    layui.use(['form'],function(){
        var form = layui.form;
        form.on('submit(reset)',function(){
            location.reload();
        })
    })
</script>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div class="layui-form">
                        <form method="post">
                            <?php if(is_array($fields) || $fields instanceof \think\Collection || $fields instanceof \think\Paginator): $i = 0; $__LIST__ = $fields;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;switch($v['type']): case "textbox": ?><div class="layui-form-item <?php if(!$v['show']): ?>layui-hide<?php endif; ?>">
    <label class="layui-form-label"><?php echo htmlentities($v['title']); ?></label>
    <div class="layui-input-inline">
        <input type="text" name="form[<?php echo htmlentities($v['name']); ?>]" value="<?php echo htmlentities((isset($model[$v['name']]) && ($model[$v['name']] !== '')?$model[$v['name']]:'')); ?>" <?php if($v['isrequire']): ?>lay-verify="required"<?php endif; ?> autocomplete="off" placeholder="<?php echo htmlentities($v['remark']); ?>" class="layui-input">
    </div>
</div>
<?php break; case "date": ?><div class="layui-form-item <?php if(!$v['show']): ?>layui-hide<?php endif; ?>">
    <label class="layui-form-label"><?php echo htmlentities($v['title']); ?></label>
    <div class="layui-input-inline">
        <input type="text" id="<?php echo htmlentities($v['name']); ?>" name="form[<?php echo htmlentities($v['name']); ?>]" value="<?php echo htmlentities((isset($model[$v['name']]) && ($model[$v['name']] !== '')?$model[$v['name']]:'')); ?>" <?php if($v['isrequire']): ?>lay-verify="required"<?php endif; if($v['values']): ?>format="<?php echo htmlentities($v['values']); ?>"<?php endif; ?> autocomplete="off" placeholder="" class="form-date layui-input">
    </div>
</div>
<?php break; case "ueditor": ?><div class="layui-form-item <?php if(!$v['show']): ?>layui-hide<?php endif; ?>" style="width:98%;">
    <label class="layui-form-label"><?php echo htmlentities($v['title']); ?></label>
    <div class="layui-input-block">
        <textarea id="<?php echo htmlentities($v['name']); ?>" name="form[<?php echo htmlentities($v['name']); ?>]" ><?php echo htmlentities((isset($model[$v['name']]) && ($model[$v['name']] !== '')?$model[$v['name']]:'')); ?></textarea>
    </div>
</div>

<script>
    layui.config({
        base: '/test/static/layui/extend/'
    }).extend([
        'ueditor'
    ]).use(['form','ueditor'],function(){
        UE.getEditor('<?php echo htmlentities($v['name']); ?>', {
            autoHeightEnabled: true,
            initialFrameHeight:500,
            serverUrl: "<?php echo url('admin/ueditor/index'); ?>"
        });
    });
</script><?php break; case "radio": ?><div class="layui-form-item <?php if(!$v['show']): ?>layui-hide<?php endif; ?>">
    <label class="layui-form-label"><?php echo htmlentities($v['title']); ?></label>
    <div class="layui-input-block">
        <?php if(is_array($v['values']) || $v['values'] instanceof \think\Collection || $v['values'] instanceof \think\Paginator): $i = 0; $__LIST__ = $v['values'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$radio): $mod = ($i % 2 );++$i;?>
        <input type="radio" name="form[<?php echo htmlentities($v['name']); ?>]" value="<?php echo htmlentities($radio['id']); ?>" title="<?php echo htmlentities($radio['val']); ?>" <?php if($model[$v['name']]==$radio['id']): ?>checked<?php endif; ?> >
        <?php endforeach; endif; else: echo "" ;endif; ?>
    </div>
</div>
<?php break; case "textarea": ?><div class="layui-form-item <?php if(!$v['show']): ?>layui-hide<?php endif; ?>">
    <label class="layui-form-label"><?php echo htmlentities($v['title']); ?></label>
    <div class="layui-input-inline" style="min-width:500px;">
        <textarea name="form[<?php echo htmlentities($v['name']); ?>]" <?php if($v['isrequire']): ?>lay-verify="required"<?php endif; ?> autocomplete="off" placeholder="<?php echo htmlentities($v['remark']); ?>" class="layui-textarea" rows="5"><?php echo htmlentities((isset($model[$v['name']]) && ($model[$v['name']] !== '')?$model[$v['name']]:'')); ?></textarea>
    </div>
</div>
<?php break; ?>
<?php endswitch; ?>

<?php endforeach; endif; else: echo "" ;endif; ?>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit="" lay-filter="commit">提交</button>
                                    <button class="layui-btn layui-btn-primary" lay-submit lay-filter="reset">重置</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['form','element','laydate'],function(){
        var form = layui.form;
        var laydate = layui.laydate;

        $(".form-date").each(function(index,item){
            var id = $(item).attr('id');
            var val = $(item).val();
            var format = $(item).attr('format');
            var config = {};
            config.elem = '#'+id;
            config.format = format==undefined?'yyyy-MM-dd HH:mm:ss':format;
            config.type = config.format.indexOf('HH')>0?'datetime':'date';
            laydate.render(config);
        });

        form.on('submit(commit)', function(obj){
            $.post({
                url:document.URL
                ,type:'post'
                ,data: obj.field
                ,success:function(res){
                    if(res.code == 1){
                        layer.msg(res.msg, {
                            offset: '15px'
                            ,icon: 1
                            ,time: 1000
                        }, function(){
                            location.href = res.url;
                        });
                    }else{
                        layer.msg(res.msg);
                    }
                }
            });
            return false;
        });

    });
</script>

</body>
</html>